export const ajax = (opt) => {
	return new Promise((resolve, reject) => {
		opt = opt || {};
		opt.url = opt.url || '';
		opt.data = opt.data || null;
		opt.method = opt.method || 'POST';
		opt.timeout = opt.timeout || 10000;
		opt.header = opt.header || {
			"Content-Type": "application/x-www-form-urlencoded"
		};
		uni.request({
			url: opt.url,
			data: opt.data,
			method: opt.method,
			header: opt.header,
		})
		.then((res) => {
			 resolve(res)
		})
		.catch(() => {
			reject('error')
		})
	})
}